package cn.sanshuilin.kst.common.api;


import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 产品运行平台
 * @author QuCeng
 */
public enum OperationPlatform {

	QTSHE_WEB("网页端"), // WEB端
	
	QTSHE_WECHAT("微信端"), // 微信端
	
	QTSHE_ANDROID_USER("安卓端"), // 安卓 APP
	
	QTSHE_IOS_USER("IOS端"), // IOS APP
	
	QTSHE_SYSTEM("K团社系统"), //K团社系统
	OTHER("其他"); // 其他
	
	private String chinese;

	public String getChinese() {
		return chinese;
	}
	
	private OperationPlatform(String chinese) {
		this.chinese = chinese;
	}
	
	public static OperationPlatform getByPlatformChinese (String chinese) {
		if (StringUtils.isEmpty(chinese)) {
			return OTHER;
		}
		
		for (OperationPlatform operationPlatform : OperationPlatform.values()) {
			if(operationPlatform.getChinese().equals(chinese)) {
				return operationPlatform;
			}
		}
		
		return OTHER;
	}
	
	public static List<Map<String , Object>> getListMap() {
		
		List<Map<String , Object>> result = new ArrayList<>();
		Map<String, Object> param = null;
		
		for (OperationPlatform o : OperationPlatform.values()) {
			param = new HashMap<String , Object>();
			param.put("key",o.name());
			param.put("chinese", o.chinese);
			result.add(param);
		}
		
		return result;
	}
	
}
